pub const FI2S_IER: usize = 0x000;
pub const FI2S_IRER: usize = 0x004;
pub const FI2S_ITER: usize = 0x008;
pub const FI2S_CER: usize = 0x00C;
pub const FI2S_CCR: usize = 0x010;
pub const FI2S_RXFFR: usize = 0x014;
pub const FI2S_TXFFR: usize = 0x018;

#[inline(always)]
pub const fn fi2s_lrbr0(x: usize) -> usize { 0x40 * x + 0x020 }
#[inline(always)]
pub const fn fi2s_rrbr0(x: usize) -> usize { 0x40 * x + 0x024 }
#[inline(always)]
pub const fn fi2s_rer0(x: usize) -> usize { 0x40 * x + 0x028 }
#[inline(always)]
pub const fn fi2s_ter0(x: usize) -> usize { 0x40 * x + 0x02C }
#[inline(always)]
pub const fn fi2s_rcr0(x: usize) -> usize { 0x40 * x + 0x030 }
#[inline(always)]
pub const fn fi2s_tcr0(x: usize) -> usize { 0x40 * x + 0x034 }
#[inline(always)]
pub const fn fi2s_isr0(x: usize) -> usize { 0x40 * x + 0x038 }
#[inline(always)]
pub const fn fi2s_imr0(x: usize) -> usize { 0x40 * x + 0x03C }
#[inline(always)]
pub const fn fi2s_rff0(x: usize) -> usize { 0x40 * x + 0x050 }
#[inline(always)]
pub const fn fi2s_tff0(x: usize) -> usize { 0x40 * x + 0x054 }

pub const FI2S_RXDMA: usize = 0x01C0;
pub const FI2S_RRXDMA: usize = 0x01C4;
pub const FI2S_TXDMA: usize = 0x01C8;
pub const FI2S_RTXDMA: usize = 0x01CC;
pub const FI2S_FRAC_DIV: usize = 0x0C00;
pub const FI2S_EVEN_DIV: usize = 0x0C04;

#[inline(always)]
pub unsafe fn write_reg32(base: *mut u8, off: usize, val: u32) {
    (base.add(off) as *mut u32).write_volatile(val);
}

#[inline(always)]
pub unsafe fn read_reg32(base: *mut u8, off: usize) -> u32 {
    (base.add(off) as *const u32).read_volatile()
}


